<?php
/*To make our add edit and delete option work we have to follow these steps
 * 1.make sure that the jqgrid is appearing on webpage in proper with all of its components structure
 * 2.make sure that our javascript file is reading the url(it can any other file that is going to handel the futhre oprations)
 * 3.when we click on the option the window we get should be in proper shape with resppective options
 * we can achive that taking care of js code there when we mention the colNames and ColModels we have to be very specific with
 * with the attribute in the colModels like we havet to mention that editable true etc.... 
 * 4.After all this simulate the programm in firefox and run the firebug to see whether our programmis reading all the file of not.
 * 5.Finally when we are going to write code for realtive url of add delete edit we have to look for the type (GET or POST) sp that we can deside which one to mention
 * 6.TO AVOID ANY CONFUSION WE CAN SIMPLY MENTION $_REQUEST FUNTION IT INCLUDES BOTH $_GET/$_POST METHODS
 */
$id = $_REQUEST["id"];
$oper = $_REQUEST["oper"];
$user = $_REQUEST["user"];
$password = $_REQUEST["password"];


    include'db.php';
    $db = new db();

    if($oper == "add"){
        
        $result=$db->query("INSERT INTO user_names (user,password) VALUES ('$user','$password')");
    }else if($oper == "edit"){
        $result= $db->query("UPDATE user_names SET user='$user', password='$password' WHERE id = '$id'");
    }else if($oper == "del"){
        $result = $db->query("DELETE FROM user_names WHERE id='$id'");
    }
?>
